package com.ybfenpan.controller.admin.wealth;


import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import com.ybfenpan.controller.core.BaseController;
import com.ybfenpan.model.log.LogMoneyTi;
import com.ybfenpan.model.log.LogShui;
import com.ybfenpan.service.log.LogMoneyTiService;
import com.ybfenpan.service.log.LogShuiService;
import com.ybfenpan.taglib.pagetag.Pagination;
import com.ybfenpan.utils.MapUtil;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


/**
 * Created by Administrator on 2016/3/25.
 */
@Controller

public class BuyShuiListController extends BaseController {


	@Resource
	private LogShuiService logShuiService;
	
    
     
   
    @RequestMapping("admin/wealth/buyShuiList.shtml")
    public String list(HttpServletRequest request) throws Exception{
        HashMap formMap = getParameterMap(request); 
       
        formMap.put("where", " 1=1 and a.state=10");  
        Pagination page = logShuiService.queryForPageList("logShuiForPage",formMap);
        request.setAttribute(Pagination.pageBeanName, page);
        return "admin/wealth/buyShuiList";
    }

    
    @RequestMapping("admin/wealth/buyShuiNo.shtml")
    public String delete(HttpServletRequest request) throws Exception{
        Map formMap = getParameterMap(request);
        int id = MapUtil.getIntValue(formMap, "id");
        if(id>0){
        	 LogShui one=this.logShuiService.getByKey(id);
        	 one.setState(30);
            logShuiService.update(one);
        }
        return "redirect:buyShuiList.shtml";
       
    }
}
